import React, { Component } from 'react';
import {
    AppRegistry,
    StyleSheet,
    Text,
    View,
    TextInput,
    Alert,
    Image,
} from 'react-native';
import LoginButton from './lib/LoginButton'
import EditView from './lib/EditView'

export default class LoginScreen extends Component {
    // static navigationOptions = {
    //     title: 'Welcome',
    // };

    render() {
        const { navigate } = this.props.navigation;
        return (
            <View style={LoginStyles.loginview}>
                <View style={{flexDirection:'column',justifyContent:'center' ,alignItems:'center'}}>
                    <Image style={{width:150 ,height:150,}} source={require('./image/login.png')}/>
                </View>
                <EditView  name='输入用户名/注册手机号' onChangeText={(text) => {
                    this.userName = text;
                }}/>
                <EditView name='输入密码'  onChangeText={(text) => {
                    this.password = text;
                }}/>
                <LoginButton name ="登录" onPressCallback={()=>{
                    navigate('Home', {user: "Lucy"});
                    // Alert.alert('Button has been pressed!');
                }}/>
                {/*<LoginButton name1 ="登录" />*/}
                <Text style={{color:"#4A90E2",textAlign:'center',marginTop:10}} >忘记密码？</Text>
            </View>
        );
    }
    // onPressCallback=()=>{
    //     navigate('Chat', {user: "Lucy"});
    // };
}


const onButtonPress = () => {
    Alert.alert('Button has been pressed!');
};
const LoginStyles = StyleSheet.create({
    loginview: {
        flex: 1,
        padding: 30,
        backgroundColor: '#ffffff',
        alignContent:'center'
    },
});